<template>
    <header class="header">
        <h1>todos</h1>
        <input autofocus="autofocus" 
        autocomplete="off" 
        placeholder="您的待办事项是?" 
        class="new-todo" 
        @keyup.enter="addTitle" />
    </header>
</template>

<script>
export default {
    emits: ['add'],
    methods: {
        addTitle(event) {
            this.$emit('add', event.target.value);
            //清空操作
            event.target.value = '';
        }
    },
}
</script>